package com.gitee.andy.rpc.core;

import java.util.function.Function;

public class MessageCodec {

	private final Function<Class<?>, MessageDecoder> func;

	private final Class<?> clazz;

	public MessageCodec(Class<?> clazz, Function<Class<?>, MessageDecoder> func) {
		super();
		this.clazz = clazz;
		this.func = func;
	}

	public MessageDecoder getDecoder() {
		return func.apply(clazz);
	}

	public MessageEncoder getEncoder() {
		return new MessageEncoder();
	}

}
